<script setup>
    const props = defineProps({
      car:String,
      moneny:Number,
    })
    const emit = defineEmits(['changeMoney'])

    const buy = () => {
      emit('changeMoney', 5)
    }
</script>

<!--对于prop传递过来的数据 模板中可以直接使用-->
<template>
    <h1 class="a">我是子组件:{{car}}</h1>
    <h2>{{moneny}}</h2>
    <button @click="buy">买买买</button>

</template>

<style scoped>

</style>